package top.yudoge.dogeeditor.llm.config

import dev.langchain4j.community.model.dashscope.QwenEmbeddingModel
import dev.langchain4j.model.chat.ChatLanguageModel
import dev.langchain4j.model.embedding.EmbeddingModel
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import top.yudoge.dogeeditor.commons.cache.InMemoryCache
import top.yudoge.dogeeditor.llm.util.tokenizer.JiebaTokenizer

@Configuration
class BeanConfig {

    @Bean
    fun globalCache() = InMemoryCache<String>()

    @Bean
    fun globalTokenizer() = JiebaTokenizer()

    @Bean
    fun getEmbeddingModel(): EmbeddingModel =
        QwenEmbeddingModel.builder()
            .modelName("text-embedding-v4")
            .apiKey("sk-*****")
            .build()

}